package WaiBao;

import java.util.Arrays;

public class TangHuan {
    public static void main(String[] args) {
        String[] name = {"李浩宇(班长)", "李向阳(副班长)", "小李(学习委员)", "薛伟(纪律委员)", "倪大红(体育委员)", "候清", "张亮", "刘恺威", "徐朗", "高波", "李博", "李建军",
                "沈浩宇", "杜天", "杜聿明", "周杰伦", "小阿七", "雨墨", "陈赫", "曾小贤", "胡一菲", "关谷", "吕子乔", "张伟", "王伟", "刘村", "小黑", "小白",
                "张金若", "汤欢(学生)"};//最后一位考生本人: 汤欢(学生)
        int[] Age = {18, 19, 20, 21, 22, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 22};//考生年龄：22岁

        double[]  ants1 = {94, 84, 93, 80, 71, 87, 76, 49, 89, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 96};
        double[]  ants2 = {78, 83, 75, 76, 86, 91, 71, 74, 91, 75, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 95};
        double[]  ants3 = {76, 98, 90, 81, 71, 64, 76, 79, 85, 60, 94, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 95};

        double bees;//代表每个学生的总分
        double cock;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            bees= (ants1)[i] + ants2[i] +ants3[i];
//            cock = ( bees * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + bees);
//            System.out.println(name[i] + "的平均分为:" + cock);
//        }



        double lice = 0, moth = 0;
        double[] worm = new double[30];
//        for (int i = 0; i < 30; i++) {
//            lice  = ants1[i] +  ants2[i] + ants3[i];
//            moth= (lice  * 1.0) / 3;
//            worm[i] = moth;
//        }
//
//        for (int i = 0; i < worm.length - 1; i++) {
//            for (int j = 0; j < worm.length - i - 1; j++) {
//                if (worm[j] < worm[j + 1]) {
//                    double tep = worm[j];
//                    worm[j] =worm[j + 1];
//                    worm[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(worm[i]);
//        }




        double coral1 = 0, coral2 = 0, coral3 = 0;//计算每门课的平均分
        double dog1 = 0,dog2 = 0,dog3 = 0;//计算每门课标准差
        double ram1 = 0,ram2 = 0, ram3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < ants1.length; i++) {
            sum2+=ants1[i];
        }
        coral1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ coral1);
        double Sum = 0;
        for (int i = 0; i < ants2.length; i++) {
            Sum+=ants2[i];
        }
        coral2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+coral2);
        double sum = 0;
        for (int i = 0; i <ants3.length; i++) {
            sum+=ants3[i];
        }
        coral3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ coral3);


////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <ants1.length; i++) {
            c1+= (ants1[i] -coral1)*(ants1[i] - coral1);
        }
        dog1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+dog1);

        for (int i = 0; i < ants2.length; i++) {
            c2+= (ants2[i] -  coral2)*(ants2[i] - coral2);
        }
        dog2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+dog2);

        for (int i = 0; i < ants3.length; i++) {
            c3+= (ants3[i] - coral3)*(ants3[i] -  coral3);
        }
        dog3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+dog3);
//////////
////////////
//        Arrays.sort(ants1);
//        Arrays.sort(ants2);
//        Arrays.sort(ants3);
//        ram1 =( ants1[14]+ants1[15])*1.0/2;
//        ram2 =(ants2[14]+ants2[15])*1.0/2;
//        ram3 =( ants3[14]+ants3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+ram1);
//        System.out.println("微生物学的中位数为:"+ram2);
//        System.out.println("人体组织解剖学的中位数为:"+ram3);

    }
}
